﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Entity
{
    /// <summary>
    /// 父级表（基础表Base）
    /// </summary>
    public class EntityBase
    {
        public EntityBase()
        {
            this.UserID = Guid.NewGuid();
            this.Creatime = DateTime.Now;
            this.Islock = false;
            this.Isdelete = false;
        }

        //[Key]//不推荐使用该方法（安全性不高）
        //[Column("P01")]
        //[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        ///// <summary>
        ///// 自增ID
        ///// </summary>
        //public Guid AoteID { get; set; }

        //在MySQL中通常不使用两个主键，会形成复合主键容易产生混乱（支持但不建议）

        [Key]
        [Column("P01")]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        /// <summary>
        /// 身份证号
        /// </summary>
        public Guid UserID { get; set; }

        /// <summary>
        /// 是否被锁定
        /// </summary>
        [Column("P02")]
        public Boolean Islock { get; set; }

        /// <summary>
        /// 是否删除
        /// </summary>
        [Column("P03")]
        public bool Isdelete { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Required]
        [Column("P04")]
        public DateTime Creatime { get; set; }
    }
}
